1. Field of the Invention
The present invention relates to an automatic object-oriented programming language program generation apparatus for automatically developing part of a program for improving productivity in developing the program using an object-oriented programming language, an automatic generation method of the program, and a storage medium for storing the method of the program.
2. Description of the Related Art
Conventionally, there has been no automatic object-oriented programming language program generating technique such as that developed by the present invention.
Since a function called a “copy constructor” to be defined by a user is prepared in an object-oriented programming language C++, the explanation about the conventional technique using the copy constructor function will be provided next.
FIG. 1 shows a class definition representing information about employees when a user generates a program using one type of the object-oriented programming language C++.
With the object-oriented programming language C++, the object which has the class definition shown in FIG. 1 is structured as shown in FIG. 2A. When the object having the structure shown in FIG. 2A is copied by using the copy constructor function which is originally provided by C++, whereby the user does not define the copy constructor, a copy constructor is automatically generated which initializes an object for each member unit, and the object having the structure shown on the right side of FIG. 2B is obtained from the copy constructor function. In FIG. 2B, although the section of the object is the same, the object is renamed when copied by the copy constructor. The pointers of an original object and the copied object both point to the same section and at the same name.
The name of the copied object in FIG. 2B is generated separately from that of the original object, and the pointers of the original object and copied object must differ from each other as shown in FIG. 2C. However, it is impossible to generate the pointers which point to separate names when an object is copied using the automatically generated copy constructor provided by the C++ language. Accordingly, the user must define the copy constructor when the user wants to copy the object in the format as shown in FIG. 2C.
One technique for facilitating a description of a program under development, in order to improve the productivity in developing a program, is using a macro.
When a macro is used, one macro instruction allows a sequence of a plurality of instructions to be included in a program. If a portion of a program to be repeatedly used is given a suitable name in advance, and registered, the registered sequence of instructions can be included by specifying this name in the program whenever necessary.
However, a programmer must define a sequence of instructions which is to be set in advance and corresponds to a macro instruction, as a macro definition, before he or she includes the macro instruction in a program for using the macro. With the macro definition, the macro instruction is translated into a sequence of instructions which is preregistered, and a plurality of instructions can be is compiled.
When a macro instruction is used to improve the productivity in program generation, it is possible to specify parameters so that a sequence of instructions or part of the program can be changed and used. Basically, however, only a process for simply replacing one instruction with a plurality of instructions is performed.
In other words, the replacement process only makes a replacement according to the contents of a macro function which is programmed beforehand, and the contents are specified by parameters, that is, a simple replacement of a character string.
Accordingly, if an argument has a complicated structure such as an object when a program is generated using an object-oriented programming language, not only the simple examination of a character string, but also the examination of the internal structure of the object must be made in order to generate a program based on such a structure. Therefore, it was impossible to apply the conventional method of using a macro to this case.
Although there is a problem that the definitions of a newly generated program conflict with the definitions of an existing program, a conflict in the definitions cannot be verified when the program is newly generated (by replacing one instruction with a plurality of instructions) using a conventional macro technique in an object-oriented programming language.
Such conflict cannot be verified when a program is generated, that is, before the program is compiled. It can be verified based on the results of program compilation etc. Accordingly, there is a problem in automatic generation of an object-oriented progrmming language program with a method using a simple replacement technique such as a macro.